package cn.beyond.vehicleManagement.dao;

import cn.beyond.vehicleManagement.pojo.SysDepartment;
import cn.beyond.vehicleManagement.pojo.SysUser;
import cn.beyond.vehicleManagement.util.DataBaseUtil;

import java.util.List;
import java.util.Map;

public class DepartmentDao {
    DataBaseUtil<SysDepartment> daodept=new DataBaseUtil<>();

    /**
     * 添加部门
     * @return
     */
    public int addDepartment(SysDepartment sysDepartment){
        return    daodept.addUtil(sysDepartment,"sys_department");
    }

    /**
     * 删除部门
     * @param obj
     * @param column
     * @return
     */
    public int deleteDepartment(Object obj,String column){
        return daodept.delByIdUtil(obj,"sys_department",column);

    }

    /**
     * 修改部门
     * @return
     */
    public int update(SysDepartment sysDepartment){
        return  daodept.updateByidUtil(sysDepartment,"sys_department");
    }

    /**
     * 查询结果返回单条记录
     * @param selectmap
     * @return
     */
    public SysDepartment selectUserByOne(SysDepartment sysDepartment, Map<String, Object> selectmap){
        return daodept.selectONE(sysDepartment,"sys_department",selectmap);
    }

    /**
     * 查询结果返回多条记录

     * @param selectmap
     * @return
     */
    public List<SysDepartment> selectUserByCondition(SysDepartment sysDepartment,
                                                     Map<String, Object> selectmap){
        return  daodept.selectAll(sysDepartment,"sys_department",selectmap);
    }
}
